package com.minarto.data {
	/**
	 * @author KIMMINHWAN
	 */
	public class UIDataManager {
		static private var _instance:UIDataManager = new UIDataManager;
		static public function getInstance():UIDataManager {
			return	_instance;
		}
		
		
		private var	_dic:Object = {};
		
		public var idField:String = "id";
		
		
		
		public function UIDataManager(){
			if (_instance) {
				throw new Error("don't create instance");
			}
		}
		
		
		public function addData($data:*):void{
			_dic[$data[idField]] = $data;
		}
		
		
		public function getData($id:String):*{
			return	_dic[$id];
		}
		
		
		public function delData($data:*):void{
			delete _dic[$data[idField]];
		}
		
		
		public function delDataByID($id:String):void{
			delete _dic[$id];
		}
		
		
		public function clear():void{
			for(var p:String in _dic){
				delete _dic[p];
			}
		}
	}
}